<template>
    <div id="main" style="width: 800px; height: 630px;"></div>
</template>
  
  <script>
  import * as echarts from 'echarts';
  
  export default {
    mounted() {
      var chartDom = document.getElementById('main');
      var myChart = echarts.init(chartDom);
      var option = {
        title: {
            text: '体测',
            left: 'center',
            top: 0,
            textStyle: {
                color: '#415058',
                fontSize: 26,
                fontWeight: 'bold'
            }
    },
        tooltip: {
          trigger: 'item',
        },
        legend: {
          top: '7%',
          left: 'center'
        },
        series: [
          {
            name: '体测得分情况',
            type: 'pie',
            radius: ['40%', '70%'],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 10,
              borderColor: '#fff',
              borderWidth: 2
            },
            label: {
              show: false,
              position: 'center',
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 40,
                fontWeight: 'bold'
              }
            },
            labelLine: {
              show: false
            },
            data: [
              { value: 90, name: '肺活量 10%' },
              { value: 100, name: '仰卧起坐/引体向上 10%' },
              { value: 86, name: '800米(女)/1000米(男) 20%' },
              { value: 90, name: '50米跑 20%' },
              { value: 80, name: '跳远 10%' },
              { value: 100, name: 'BMI 15%' },
              { value: 75, name: '坐位体前屈 10%' }
            ]
          }
        ]
      };
      option && myChart.setOption(option);
    }
  };
  </script>